<template>
    <div>
        <p>遍历数组</p>
        <ul>
            <li v-for="(item,index) in listArr" :key="item.id">
            {{index}}-{{item.id}}-{{item.titlel}}
            </li>
        </ul>
        <p>遍历对象</p>
        <ul v-if="flag">
                <li v-for="(val,key1,index) in listObj" :key="key1">
                {{index}}-{{key1}}-{{val.title}}
                </li>
        </ul>
    </div>

</template>

<script>
export default {
    data() {
        return {
            flag: true,
            listArr: [
                {id: 'a',titlel: '标题1'},
                {id: 'b',titlel: '标题2'},
                {id: 'c',titlel: '标题3'},
            ],
            listObj: {
                a: {title:'标题1'},
                b: {title:'标题2'},
                c: {title:'标题3'},

            }

        }
    }
}
</script>

<style>

</style>